import type { RouteRecordRaw } from 'vue-router';

// 存放路由
export const staticroutes: RouteRecordRaw[] = [
  {
    path: '/login',
    component: () => import('@/views/Login/index.vue'),
    name: 'login',
  },
  {
    path: '/',
    component: () => import('@/layouts/index.vue'),
    name: 'layout',
    redirect: '/home', // 可选的默认重定向
    meta: {
      title: '首页',
    },
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/Home/index.vue'),
        meta: {
          icon: 'UserOutlined',
          title: '首页',
        },
      },
      {
        path: 'product',
        component: () => import('@/views/Product/index.vue'),
        name: 'product',
        redirect: '/product/list',
        meta: {
          icon: 'UserOutlined',
          title: '产品管理',
        },
        children: [
          {
            path: 'list',
            component: () => import('@/views/Product/List/index.vue'),
            name: 'list',
            meta: {
              title: '产品列表',
            },
          },
          {
            path: 'category',
            component: () => import('@/views/Product/Category/index.vue'),
            name: 'category',
            meta: {
              title: '产品分类',
            },
          },
        ],
      },
      {
        path: 'order',
        component: () => import('@/views/Order/index.vue'),
        name: 'order',
        redirect: '/order/order-list',
        meta: {
          icon: 'UserOutlined',
          title: '订单管理',
        },
        children: [
          {
            path: 'order-list',
            component: () => import('@/views/Order/List/index.vue'),
            name: 'order-list',
            meta: {
              title: '订单列表',
            },
          },
          {
            path: 'collect',
            component: () => import('@/views/Order/Collect/index.vue'),
            name: 'collect',
            meta: {
              title: '汇总清单',
            },
          },
          {
            path: 'contract',
            name: 'contract',
            component: () => import('@/views/Order/Contract/index.vue'),
            meta: {
              title: '订单审核',
            },
          },
        ],
      },
      {
        path: 'advert',
        component: () => import('@/views/Advert/index.vue'),
        name: 'advert',
        redirect: '/advert/advert-list',
        meta: {
          icon: 'UserOutlined',
          title: '广告分类',
        },
        children: [
          {
            path: 'advert-list',
            component: () => import('@/views/Advert/List/index.vue'),
            name: 'advert-list',
            meta: {
              title: '广告列表',
            },
          },
        ],
      },
      {
        path: 'system',
        name: 'system',
        component: () => import('@/views/SystemManage/index.vue'),
        redirect: '/system/role',
        meta: {
          icon: 'UserOutlined',
          title: '系统管理',
        },
        children: [
          {
            path: 'role',
            name: 'role',
            component: () => import('@/views/SystemManage/Role/index.vue'),
            meta: {
              title: '角色管理',
            },
          },
          {
            path: 'department',
            name: 'department',
            component: () =>
              import('@/views/SystemManage/Department/index.vue'),
            meta: {
              title: '部门管理',
            },
          },
        ],
      },
    ],
  },
  {
    path: '/404',
    component: () => import('@/views/404/index.vue'),
    name: '404',
  },
  {
    path: '/:pathMatch(.*)*',
    redirect: '/404',
    name: 'any',
  },
];

export const menu = [
  {
    path: 'home',
    name: 'home',
    component: () => import('@/views/Home/index.vue'),
    meta: {
      icon: 'UserOutlined',
      title: '首页',
    },
  },
  {
    path: 'product',
    component: () => import('@/views/Product/index.vue'),
    name: 'product',
    redirect: '/product/list',
    meta: {
      icon: 'UserOutlined',
      title: '产品管理',
    },
    children: [
      {
        path: 'list',
        component: () => import('@/views/Product/List/index.vue'),
        name: 'list',
        meta: {
          title: '产品列表',
        },
      },
      {
        path: 'category',
        component: () => import('@/views/Product/Category/index.vue'),
        name: 'category',
        meta: {
          title: '产品分类',
        },
      },
    ],
  },
  {
    path: 'order',
    component: () => import('@/views/Order/index.vue'),
    name: 'order',
    redirect: '/order/order-list',
    meta: {
      icon: 'UserOutlined',
      title: '订单管理',
    },
    children: [
      {
        path: 'order-list',
        component: () => import('@/views/Order/List/index.vue'),
        name: 'order-list',
        meta: {
          title: '订单列表',
        },
      },
      {
        path: 'collect',
        component: () => import('@/views/Order/Collect/index.vue'),
        name: 'collect',
        meta: {
          title: '汇总清单',
        },
      },
      {
        path: 'contract',
        name: 'contract',
        component: () => import('@/views/Order/Contract/index.vue'),
        meta: {
          title: '订单审核',
        },
      },
    ],
  },
  {
    path: 'advert',
    component: () => import('@/views/Advert/index.vue'),
    name: 'advert',
    redirect: '/advert/advert-list',
    meta: {
      icon: 'UserOutlined',
      title: '广告分类',
    },
    children: [
      {
        path: 'advert-list',
        component: () => import('@/views/Advert/List/index.vue'),
        name: 'advert-list',
        meta: {
          title: '广告列表',
        },
      },
    ],
  },
  {
    path: 'system',
    name: 'system',
    component: () => import('@/views/SystemManage/index.vue'),
    redirect: '/system/role',
    meta: {
      icon: 'UserOutlined',
      title: '系统管理',
    },
    children: [
      {
        path: 'role',
        name: 'role',
        component: () => import('@/views/SystemManage/Role/index.vue'),
        meta: {
          title: '角色管理',
        },
      },
      {
        path: 'department',
        name: 'department',
        component: () => import('@/views/SystemManage/Department/index.vue'),
        meta: {
          title: '部门管理',
        },
      },
    ],
  },
];
